const router = require('koa-router')();
const userAdminapi = require('../controllers/UserAdminAPI');
const msgAdminapi = require('../controllers/MsgAdminAPI');
const orderAdminapi = require('../controllers/OrderAdminAPI');
const goodsAdminapi = require('../controllers/GoodsAdminAPI');


//登录
router.post('/api/admin/login', userAdminapi.login);

//查询所有用户
router.get('/api/admin/allUser', userAdminapi.getAllUser);

//删除指定用户
router.delete('/api/admin/deleteUser', userAdminapi.deleteUser);

//搜索用户
router.get('/api/admin/searchUser', userAdminapi.searchUser);

//修改密码
router.post('/api/admin/changePwd', userAdminapi.changePwd);

//查询未回复信息
router.get('/api/admin/noReplyMsg', msgAdminapi.getNoReplyMsg);

//查询已回复信息
router.get('/api/admin/repliedMsg', msgAdminapi.getRepliedMsg);

//回复信息
router.post('/api/admin/reply', msgAdminapi.reply);

//获取订单s
router.get('/api/admin/orders', orderAdminapi.getOrders);

//获取订单一些可供修改的信息
router.get('/api/admin/order', orderAdminapi.getOrder);

//修改订单
router.post('/api/admin/changeOrder', orderAdminapi.changeOrder);

//删除订单
router.delete('/api/admin/deleteOrder', orderAdminapi.deleteOrder);

//得到类目
router.get('/api/admin/getType', goodsAdminapi.getType);

//得到商品
router.get('/api/admin/getGoodsByType', goodsAdminapi.getGoodsByType);

//增加类目
router.post('/api/admin/addType', goodsAdminapi.addType);

//得到商品
router.get('/api/admin/getGoodsInfo', goodsAdminapi.getGoodsInfo);

//增加商品
router.post('/api/admin/addGoods', goodsAdminapi.addGoods);

//增加规格
router.post('/api/admin/addSpec', goodsAdminapi.addSpec);

//删除规格
router.post('/api/admin/deleteSpec', goodsAdminapi.deleteSpec);

//更新商品信息
router.post('/api/admin/updateGoods', goodsAdminapi.updateGoods);

//删除商品
router.delete('/api/admin/deleteGoods', goodsAdminapi.deleteGoods);

module.exports = router;